<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/21
 * Time: 14:55
 */
$content = file_get_contents("http://huaban.com/search/?q=%E5%B0%8F%E6%B8%85%E6%96%B0&j7u4chl3&page=2&per_page=20&wfl=1");
//echo $content;

if(preg_match_all('/"orig_source":"(http:\/\/.*?\.jpg.*?)"/i',$content,$m)){
    var_dump($m);
    foreach($m[1] as $item){
        $url = $item;
//        var_dump($url);
        $fileName = substr(strrchr($url,'/'),1);
        $fileFullName = __DIR__."/huabanpic/".$fileName;
        echo $url;
        $pic = @file_get_contents($url);
//        exit;
//        var_dump($fileFullName);
        @file_put_contents($fileFullName,$pic);
//        break;
    }

}